package org.example.product.controller.front;

import org.example.core.utils.R;
import org.example.product.service.SkuInfoService;
import org.example.product.to.cart.SkuInfoTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author 小杰_cc
 * @version 1.0
 */
@RestController
@RequestMapping("/pms/front/skuInfo")
public class SkuInfoFrontController {

    @Autowired
    private SkuInfoService skuInfoService;

    // 添加购物车所需商品信息
    @PostMapping("/list")
    public R<Map<Long, SkuInfoTo>> queryCartSku(@RequestBody List<Long> skuIds){
        Map<Long, SkuInfoTo> skuInfoToMap = skuInfoService.queryCartSkus(skuIds);
        return R.ok(skuInfoToMap);
    }
}